package com.lnt.spring.conversion;


import com.lnt.spring.bean.User;

import java.beans.PropertyEditor;
import java.beans.PropertyEditorSupport;

/**
 * @title : JDK自带类型转换
 * @createDate : 2021-11-13 10:29
 * @creater : LuNanTing
 * @className : StringToUserPropertyEditor
 */
public class StringToUserPropertyEditor extends PropertyEditorSupport implements PropertyEditor {

    @Override
    public void setAsText(String text) throws IllegalArgumentException {
        User user = new User();
        user.setName(text);
        this.setValue(user);
    }
}
